﻿@using BXJG.Utils.Application.Share.Dtos
@using Microsoft.AspNetCore.Components.Sections
@using ZLJ.Application.Share.AssociatedCompany
@inherits DetailUpdateBaseComponent< AssociatedCompanyDto, long,  AssociatedCompanyEditDto>
<SectionContent SectionName=@($"{Master}-detail-update-title")>
    <Icon Type=@detailUpdateIcon Theme=@IconThemeType.Outline />
    @(detailUpdateText)@(FuncName)
</SectionContent>
<SectionContent SectionName=@($"{Master}-detail-update-body")>

   
        <Form @ref="frm" ValidateOnChange="true" Model="editDto" LabelColSpan="3" WrapperColSpan="21" OnFinish="OnFinish">
        <FormItem Label="名称">
            @if (IsShowUpdate)
            {
                <Input @bind-Value="@context.Name" AllowClear />
            }
            else
            {
                <span class="frm-field-readonly">
                    @dto.Name
                </span>
            }
            
            </FormItem>
        <FormItem Label="联系人">
            @if (IsShowUpdate)
            {
                <Input @bind-Value="@context.LinkMan" AllowClear />
            }
            else
            {
                <span class="frm-field-readonly">
                    @dto.LinkMan
                </span>
            }
 
            </FormItem>
        <FormItem Label="联系电话">
            @if (IsShowUpdate)
            {
                <Input @bind-Value="@context.LinkPhone" AllowClear />
            }
            else
            {
                <span class="frm-field-readonly">
                    @dto.LinkPhone
                </span>
            }
            </FormItem>
        <FormItem Label="所属地区">
            @if (IsShowUpdate)
            {
                <AdministrativeTreeSelect @bind-TreeIdNullable=context.AreaId IsKeyId AllowClear />
            }
            else
            {
                <span class="frm-field-readonly">
                    @dto.AreaDisplayName
                </span>
            }
              
            </FormItem>
        <FormItem Label="地址">
            @if (IsShowUpdate)
            {
                <Input @bind-Value="@context.Address" AllowClear />
            }
            else
            {
                <span class="frm-field-readonly">
                    @dto.Address
                </span>
            }

            </FormItem>
        <FormItem Label="等级">
            @if (IsShowUpdate)
            {
                <TreeSelectDataDictionary @bind-TreeIdNullable=context.LevelId IsKeyId AllowClear ParentName="kehuJibie" />
            }
            else
            {
                <span class="frm-field-readonly">
                    @dto.LevelDisplayName
                </span>
            }

        
            </FormItem>
        <FormItem Label="是否启用">
            @if (IsShowUpdate)
            {
                <Switch @bind-Checked=context.IsActive />
            }
            else
            {
                <span class="frm-field-readonly">
                    <Switch @bind-Checked=dto.IsActive Disabled />
                </span>
            }
            </FormItem>
        </Form>
   
</SectionContent>
<SectionContent SectionName=@($"{Master}-detail-update-btns")>
    @if (IsShowDelete)
    {
        <Popconfirm Title="确定删除此项吗?" OnConfirm=BtnDeleteClick>
            <Button Loading=isDeleting Danger=true>删除</Button>
        </Popconfirm>
    }
    <ButtonGroup>
        @if (IsShowRefresh)
        {
            <Button OnClick="BtnRefreshClick" Loading=isRefreshing Disabled=IsBusy>刷新</Button>
        }
        @if (IsShowBeginEdit)
        {
            <Button OnClick="BtnBeginEditClick" Loading=isFormIniting Type="@ButtonType.Primary">修改</Button>
        }
        else if (IsShowUpdate)
        {
            <Button OnClick="BtnResetClick" Loading=isReseting Disabled=IsBusy Icon="@IconType.Outline.Redo">重置</Button>
            <Button OnClick="BtnCancelEditClick" Disabled=IsBusy Icon="@IconType.Outline.Rollback">放弃修改</Button>
            <Button OnClick="BtnUpdateClick" Type="@ButtonType.Primary" Loading="@isUpdating" Disabled="@IsBusy" Icon="@IconType.Outline.Save">保存</Button>
        }
    </ButtonGroup>
</SectionContent>